﻿from django.contrib import admin
from django.conf.urls.defaults import *
from yazasport import settings

admin.autodiscover()

if settings.DEBUG:
    urlpatterns = patterns('',
        (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
        (r'^uploads/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    )
	
urlpatterns += patterns('',
    (r'^admin/', include(admin.site.urls)),
    (r'^ajax/geography/$', 'ajax.views.get_geography_object'),
    (r'^ajax/place/$', 'ajax.views.get_place'),
    (r'^login/$', 'registration.views.login'),
    (r'^logout/$', 'registration.views.logout', {'next_page': '/'}),
    (r'^registration/$', 'registration.views.registration'),
    (r'^profile/$', 'userprofile.views.view_profile', {'template_name': 'userprofile/view.html'}),
    (r'^profile/(?P<id>\d)/$', 'userprofile.views.view_profile', {'template_name': 'userprofile/view.html'}),
    (r'^profile/edit/$', 'userprofile.views.edit_profile', {'template_name': 'userprofile/edit.html'}),
    (r'^profile/friends/(?P<id>\d)/$', 'userprofile.views.view_list_profile', {'search': False, 'template_name': 'userprofile/list_view.html'}),
    (r'^search/$', 'userprofile.views.view_list_profile', {'search': True, 'template_name': 'userprofile/list_view.html'}),
    (r'^friendship/add/(?P<id>\d)/$', 'userprofile.views.add_friendship'),
    (r'^friendship/delete/(?P<id>\d)/$', 'userprofile.views.delete_friendship'),
    (r'^friendship/allow/(?P<id>\d)/$', 'userprofile.views.allow_friendship'),
    (r'^friendship/deny/(?P<id>\d)/$', 'userprofile.views.deny_friendship'),
    (r'^organization/edit/(?P<id>\d)/$', 'organization.views.edit_membership'),
    (r'^messages/show/$', 'communication.views.show_message', {'sent':False, 'template_name': 'communication/show_all.html'}),
    (r'^messages/show/sent/$', 'communication.views.show_message', {'sent':True, 'template_name': 'communication/show_all.html'}),
    (r'^messages/show/(?P<id>\d)/$', 'communication.views.show_message', {'template_name': 'communication/show.html'}),
    (r'^messages/post/$', 'communication.views.post_message', {'template_name': 'communication/post.html'}),
    (r'^messages/post/(?P<to>\d)/$', 'communication.views.post_message', {'template_name': 'communication/post.html'}),
    (r'^$', include('yazasport.staticpages.urls')),
)
